﻿#region License
//------------------------------------------------------------
// Copyright (c) Denis Vuyka.  All rights reserved.
// This source code is subject to terms and conditions of the 
// Microsoft Reciprocal License (Ms-RL) License for Carcass. 
// A copy of the license can be found in the License.txt file 
// at the root of this distribution. 
// By using this source code in any fashion, you are agreeing 
// to be bound by the terms of the 
// Microsoft Reciprocal License (Ms-RL) License
// You must not remove this notice from this software.
//------------------------------------------------------------
#endregion

using System;
using System.ComponentModel;
using System.IO;
using Carcass.Contents;

namespace DemoShell.Modules
{
  public abstract class DocumentBase : IDocument, INotifyPropertyChanged
  {
    #region IDocument Members

    public abstract bool CanLoad { get; }
    public abstract bool CanSave { get; }

    public abstract void Load(Stream stream);
    public abstract void Save(Stream stream);

    #endregion

    #region INotifyPropertyChanged Members

    public event PropertyChangedEventHandler PropertyChanged;

    protected virtual void OnPropertyChanged(string propertyName)
    {
      if (string.IsNullOrEmpty(propertyName)) throw new ArgumentNullException("propertyName");

      PropertyChangedEventHandler handler = PropertyChanged;
      if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
    }

    #endregion
  }
}
